
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
 */
package be.ac.ua.pats.thesisrobotica.robot.sensors;

/**
 *
 * @author Admin
 */
public class InterrupterThread implements Runnable {
    Thread                r;
    lejos.nxt.TouchSensor sensor;

    public InterrupterThread(Thread r, lejos.nxt.TouchSensor sensor) {
        this.r      = r;
        this.sensor = sensor;
    }

    public void run() {
        Boolean currentPressed = sensor.isPressed();

        while (currentPressed == sensor.isPressed()) {}

        r.interrupt();
    }
}
